﻿@model Parichay.Domain.Models.GroupHomeModel

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
    
}
@section Styles{
    <link href="@Url.Content("~/Content/styles/jquery.ui.css")" rel="stylesheet" type="text/css" />
}
<script src="@Url.Content("~/Content/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
<fieldset>
<legend><h2>User Groups</h2></legend>
<table class="tblAllBorders">
<tr><th colspan="9">Parichay Groups</th></tr>

    <tr>
            <th>
            Display Name
        </th>
        <th>
            About
        </th>
        <th>
            Website URL (If Any?)
        </th>
        <th></th>

    </tr>

@foreach (var item in Model.allGroups)
{
    <tr>
    <td>
            @Html.ActionLink(item.Name, "Details", new { id = item.Id })

           <div id="GJDiv@(item.Id)"></div>

             @*@Html.DisplayFor(modelItem => item.Name)*@
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.About)
        </td>
        <td>
    @item.Url
        </td>
        <td>
        @if (item.OwnerId == (((Parichay.Domain.Models.CustomIdentity)User.Identity).UserKey))
        {
            @Html.ActionLink("Edit","Update",new{id=item.Id})
        }
        </td>
        @*
        <td>
            @Html.DisplayFor(modelItem => item.Createdon)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Modifiedon)
        </td>
       <td><a href='#' onclick='javascript:loadGroupJoin("@(item.Id)");'>Join</a></td>*@
    </tr>
}
</table>
</fieldset>

@if((User.IsInRole("Admin"))||(User.IsInRole("Super Admin")))
{
    <br />
     @Html.ActionLink("Create New Group", "Create") <span>|</span>
     @Html.ActionLink("Manage Groups", "Manage")

}